package by.semerikov.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

public class SaveProposalVsDriverForm extends ActionForm{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private Integer driverId;
	private Integer tripId;
	
	@Override
	public ActionErrors validate(ActionMapping mapping,
			HttpServletRequest request) {
		ActionErrors errors = new ActionErrors();
	    if (driverId == null) {
	        errors.add("errorDriver", new ActionMessage("error.driver.required"));
	    }
	    if (tripId == null ) {
	        errors.add("errorTrip", new ActionMessage("error.trip.required"));
	    }
	    return errors;
	}
	
	public Integer getDriverId() {
		return driverId;
	}
	public void setDriverId(Integer driverId) {
		this.driverId = driverId;
	}
	public Integer getTripId() {
		return tripId;
	}
	public void setTripId(Integer tripId) {
		this.tripId = tripId;
	}
}
